package com.example.mywanandroid.home;

import android.content.Intent;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.example.mywanandroid.R;
import com.example.mywanandroid.util.GlobalLoading;

public class WebViewActivity extends AppCompatActivity {
    private GlobalLoading homeLoading;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        homeLoading = new GlobalLoading(this);
        homeLoading.showLoadUi(false, 0);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.home_webview);
        WebView webView = findViewById(R.id.home_web_view);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.setWebViewClient(new WebViewClient());
        //获取对应链接
        Intent intent = getIntent();
        String link = intent.getStringExtra("link");
        webView.loadUrl(link);
        homeLoading.showLoadUi(true, 0);
    }
}
